package assignmentonepenguins

class Customer {
    String username
    String email
    String password
    Date dateCreated

    static constraints = {
        username(nullable:false, unique: true, matches: "[_A-Za-z0-9-]+")
        // One or more Alphanumeric characters,
        // followed by a "." and one or more additional Alphanumeric characters (Optional),
        // followed by an "@" symbol,
        // followed by one or more Alphanumeric characters,
        // followed by a "." and one ore more additional Alphanumeric characters
        email(nullable:false, unique:true,
              matches: "[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)")
        password(size:6..8)
        dateCreated(nullable:true)
    }
}
